﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="PublicSituation.aspx.cs" Inherits="ValuationClient.项目勘察.PublicSituation" %>

<!DOCTYPE html>

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title></title>
    <link href="../jquery-easyui-1.5.2/themes/default/easyui.css" rel="stylesheet" />
    <link href="../jquery-easyui-1.5.2/css/wu.css" rel="stylesheet" />
    <link href="../jquery-easyui-1.5.2/css/icon.css" rel="stylesheet" />
    <script src="../jquery-easyui-1.5.2/jquery.min.js"></script>
    <script src="../jquery-easyui-1.5.2/jquery.easyui.min.js"></script>
    <script src="../jquery-easyui-1.5.2/locale/easyui-lang-zh_CN.js"></script>
    <script src="../jquery-easyui-1.5.2/easyloader.js"></script>
    <script src="../jquery-easyui-1.5.2/jquery.params.js"></script>
</head>
<body>
    <div class="demo-info">
        <div class="demo-tip icon-tip"></div>
        <%--<div>Fill the form and submit it.</div>--%>
    </div>
    <div style="margin: 0;"></div>
    <form id="form1" runat="server">
        <div class="easyui-panel" fit="true" style="border: none;">
            <div style="margin-left: 30px;" id="ff">
                <table>
                    <tr>
                        <td>所在楼号：</td>
                        <td style="padding-left: 50px;">
                            <input class="easyui-textbox" type="text" id="louhao" style="width: 800px;" placeholder="请输入所在楼号" />
                        </td>
                    </tr>
                    <tr>
                        <td>地图：</td>
                        <td style="padding-left: 50px;">
                            <div style="width: 800px; height: 300px; border: 1px solid blue;" id="map">
                            </div>
                        </td>
                    </tr>
                    <tr>
                        <td>定位坐标：</td>
                        <td style="padding-left: 50px;">
                            <input class="easyui-textbox" type="text" id="zuobiao" style="width: 800px;" readonly="true" />
                        </td>
                    </tr>
                    <tr>
                        <td>定位地址：</td>
                        <td style="padding-left: 50px;">
                            <input class="easyui-textbox" type="text" id="addr" style="width: 800px;" />
                        </td>
                    </tr>
                    <tr>
                        <td>房屋结构：</td>
                        <td style="padding-left: 50px;">
                            <select class="easyui-combobox" style="width: 800px;" id="select1">
                            </select>
                        </td>
                    </tr>
                    <tr>
                        <td>建筑类型：</td>
                        <td style="padding-left: 50px;">
                            <select class="easyui-combobox" style="width: 800px;" id="select2">
                            </select>
                        </td>
                    </tr>
                    <tr>
                        <td>外立面装饰：</td>
                        <td style="padding-left: 50px;">
                            <select class="easyui-combobox" style="width: 800px;" id="select3">
                            </select>
                        </td>
                    </tr>
                    <tr>
                        <td>公共部位装饰：</td>
                        <td style="padding-left: 50px;">
                            <select class="easyui-combobox" style="width: 800px;" id="select4">
                            </select>
                        </td>
                    </tr>
                    <tr>
                        <td>电梯：</td>
                        <td style="padding-left: 50px;">
                            <select class="easyui-combobox" style="width: 800px;" id="select5">
                            </select><br />
                            <input type="number" min="1" id="dnum" />
                        </td>
                    </tr>
                    <tr>
                        <td>供气：</td>
                        <td style="padding-left: 50px;">
                            <select class="easyui-combobox" style="width: 800px;" id="select6">
                            </select>
                        </td>
                    </tr>
                    <tr>
                        <td>供水：</td>
                        <td style="padding-left: 50px;">
                            <select class="easyui-combobox" style="width: 800px;" id="select7">
                            </select>
                        </td>
                    </tr>
                    <tr>
                        <td>供暖：</td>
                        <td style="padding-left: 50px;">
                            <select class="easyui-combobox" style="width: 800px;" id="select8">
                            </select>
                        </td>
                    </tr>
                    <tr>
                        <td>门禁系统：</td>
                        <td style="padding-left: 50px;">
                            <select class="easyui-combobox" style="width: 800px;" id="select9">
                            </select>
                        </td>
                    </tr>
                    <tr>
                        <td>其他:</td>
                        <td style="padding-left: 50px;">
                            <textarea id="message" style="height: 60px; width: 800px;" placeholder="说点什么...最少输入10个字"></textarea>
                        </td>
                    </tr>
                </table>
            </div>
            <div style="text-align: center; padding: 5px">
                <a href="javascript:void(0)" class="easyui-linkbutton" onclick="submitForm()">提交</a>
            </div>
        </div>
    </form>


    <script type="text/javascript" src="http://api.map.baidu.com/api?v=2.0&ak=4OFP8rc1v0r74nUe45AtjtiAv8KnVfZI"></script>
    <script>



        function submitForm() {
            var louhao = $("#louhao").val();
            var zuo = $("#zuobiao").val();
            var address = $("#addr").val();
            var housje = $("#select1").combobox('getValue');
            var jtype = $("#select2").combobox('getValue');
            var wshi = $("#select3").combobox('getValue');
            var gshi = $("#select4").combobox('getValue');
            var dian = $("#select5").combobox('getValue');
            var dnum = $("#dnum").val();

            var gqi = $("#select6").combobox('getValue');
            var gshui = $("#select7").combobox('getValue');
            var gnuam = $("#select8").combobox('getValue');
            var door = $("#select9").combobox('getValue');
            var qita = $("#message").val();
            var prenum = $.query.get("id");//项目号;
   

            $.ajax({
                type: "post", //要用post方式                 
                url: "http://localhost:55439/api/prospecting/InsertEAFloors",//方法所在页面和方法名
                data: {
                    ProjectNumber: prenum, floor_Number: louhao, floor_Landmark: zuo,
                    floor_Address: address, floor_HouseStructure: housje, floor_BuildType: jtype,
                    floor_Facade: wshi, floor_Public: gshi, floor_Lift: dian,
                    floor_LiftNum: dnum, floor_Gas: gqi, floor_Water: gshui,
                    floor_Warm: gnuam, floor_Door: door, floor_Explain: qita
                },
                success: function (data) {

                    if (data == true) {
                        $.messager.alert("提示信息", "保存成功");
                    }
                    else
                        $.messager.alert("提示信息", "保存失败");
                }
            });
        }


        $(function () {
            //创建地图实例
            var map = new BMap.Map("map");
            //创建点坐标
            var point = new BMap.Point(116.404, 39.915);
            //地图初始化
            map.centerAndZoom(point, 15);

            var marker = new BMap.Marker(point);        // 创建标注    
            map.addOverlay(marker);                     // 将标注添加到地图中

            //点击事件
            map.addEventListener("click", function (e) {
                map.removeOverlay(marker);
                //创建点坐标
                var xpoint = new BMap.Point(e.point.lng, e.point.lat);
                //地图初始化
                //map.centerAndZoom(xpoint, 15);
                // 创建标注
                marker = new BMap.Marker(xpoint);
                map.panTo(xpoint);
                // 将标注添加到地图中
                map.addOverlay(marker);
                $("#zuobiao").val(e.point.lng, e.point.lat);

                //内存释放
                // map.removeOverlay(marker);
                // marker.dispose();

            });
        })




        // 绑定房屋结构下拉框
        select1();
        function select1() {
            $.ajax({
                type: "get",
                url: "http://localhost:55439/api/Dictionary?i=" + 18,
                success: function (obj) {
                    $('#select1').combobox({
                        data: obj,
                        valueField: 'Dictionary_Number',
                        textField: 'dictionary_Name'
                    })
                }
            })
        }

        // 绑定建筑类型下拉框
        select2();
        function select2() {
            $.ajax({
                type: "get",
                url: "http://localhost:55439/api/Dictionary?i=" + 19,
                success: function (obj) {
                    $('#select2').combobox({
                        data: obj,
                        valueField: 'Dictionary_Number',
                        textField: 'dictionary_Name'
                    })
                }
            })
        }


        // 绑定外立面装饰下拉框
        select3();
        function select3() {
            $.ajax({
                type: "get",
                url: "http://localhost:55439/api/Dictionary?i=" + 20,
                success: function (obj) {
                    $('#select3').combobox({
                        data: obj,
                        valueField: 'Dictionary_Number',
                        textField: 'dictionary_Name'
                    })
                }
            })
        }

        // 绑定公共部位装饰下拉框
        select4();
        function select4() {
            $.ajax({
                type: "get",
                url: "http://localhost:55439/api/Dictionary?i=" + 21,
                success: function (obj) {
                    $('#select4').combobox({
                        data: obj,
                        valueField: 'Dictionary_Number',
                        textField: 'dictionary_Name'
                    })
                }
            })
        }

        // 绑定电梯下拉框
        select5();
        function select5() {
            $.ajax({
                type: "get",
                url: "http://localhost:55439/api/Dictionary?i=" + 22,
                success: function (obj) {
                    $('#select5').combobox({
                        data: obj,
                        valueField: 'Dictionary_Number',
                        textField: 'dictionary_Name'
                    })
                }
            })
        }

        // 绑定供气下拉框
        select6();
        function select6() {
            $.ajax({
                type: "get",
                url: "http://localhost:55439/api/Dictionary?i=" + 23,
                success: function (obj) {
                    $('#select6').combobox({
                        data: obj,
                        valueField: 'Dictionary_Number',
                        textField: 'dictionary_Name'
                    })
                }
            })
        }

        // 绑定供水下拉框
        select7();
        function select7() {
            $.ajax({
                type: "get",
                url: "http://localhost:55439/api/Dictionary?i=" + 24,
                success: function (obj) {
                    $('#select7').combobox({
                        data: obj,
                        valueField: 'Dictionary_Number',
                        textField: 'dictionary_Name'
                    })
                }
            })
        }

        // 绑定供暖下拉框
        select8();
        function select8() {
            $.ajax({
                type: "get",
                url: "http://localhost:55439/api/Dictionary?i=" + 25,
                success: function (obj) {
                    $('#select8').combobox({
                        data: obj,
                        valueField: 'Dictionary_Number',
                        textField: 'dictionary_Name'
                    })
                }
            })
        }

        // 绑定门禁系统下拉框
        select9();
        function select9() {
            $.ajax({
                type: "get",
                url: "http://localhost:55439/api/Dictionary?i=" + 26,
                success: function (obj) {
                    $('#select9').combobox({
                        data: obj,
                        valueField: 'Dictionary_Number',
                        textField: 'dictionary_Name'
                    })
                }
            })
        }
    </script>
</body>
</html>
